<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>03-运算符</title>
</head>
<body>
<script>
    // 算数运算符 + - * / % // ** ++ --
    // ++ num = num + 1
    var num = 2
    num++
    console.log(num)
    num--
    console.log(num)
    var name = "张" + 3 // + 可以实现字符串拼接
    console.log(name, typeof name)  //张3 string

    // 赋值运算符 += -= *= /=
    var num1 = 6
    num1 += 3  // num1 = num1 + 3
    console.log(num1)
</script>
<script>
    // 比较运算符 ==   ！=   >  >=  <  <=  ===(全等于)   !==(不全等于)
    console.log(3 == "3") //true
    console.log(3 === "3") //false
    console.log(3 !== "3") //true

    // 逻辑运算符 $$ || !
    console.log(true && false) //false
    console.log(true || false) //true
    console.log(!true) //false

    // 三目运算符
    var num2 = 10;
    var num3 = 5;

    var max = (num2 > num3) ? num2 : num3
    console.log(max); //10
</script>
</body>
</html>